﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZenSystemService.Api.Migrations
{
    /// <inheritdoc />
    public partial class TrainingItemProductTypes : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_TrainingItems_ProductTypeId",
                table: "TrainingItems");

            migrationBuilder.DropColumn(
                name: "ProductTypeId",
                table: "TrainingItems");

            migrationBuilder.AddColumn<string>(
                name: "Status",
                table: "TraineeCourseTrainings",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<int>(
                name: "TrainingItemId",
                table: "ProductTypes",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_ProductTypes_TrainingItemId",
                table: "ProductTypes",
                column: "TrainingItemId");

            migrationBuilder.AddForeignKey(
                name: "FK_ProductTypes_TrainingItems_TrainingItemId",
                table: "ProductTypes",
                column: "TrainingItemId",
                principalTable: "TrainingItems",
                principalColumn: "TrainingItemId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_ProductTypes_TrainingItems_TrainingItemId",
                table: "ProductTypes");

            migrationBuilder.DropIndex(
                name: "IX_ProductTypes_TrainingItemId",
                table: "ProductTypes");

            migrationBuilder.DropColumn(
                name: "Status",
                table: "TraineeCourseTrainings");

            migrationBuilder.DropColumn(
                name: "TrainingItemId",
                table: "ProductTypes");

            migrationBuilder.AddColumn<int>(
                name: "ProductTypeId",
                table: "TrainingItems",
                type: "int",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TrainingItems_ProductTypeId",
                table: "TrainingItems",
                column: "ProductTypeId");
        }
    }
}
